

package com.lry.rpc.starter.context;

import java.util.Map;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.validation.DataBinder;

public class DefaultConfigurationBeanBinder implements ConfigurationBeanBinder {
    public DefaultConfigurationBeanBinder() {
    }

    public void bind(Map<String, Object> configurationProperties, boolean ignoreUnknownFields, boolean ignoreInvalidFields, Object configurationBean) {
        DataBinder dataBinder = new DataBinder(configurationBean);
        dataBinder.setIgnoreInvalidFields(ignoreUnknownFields);
        dataBinder.setIgnoreUnknownFields(ignoreInvalidFields);
        MutablePropertyValues propertyValues = new MutablePropertyValues(configurationProperties);
        dataBinder.bind(propertyValues);
    }
}
